package com.norra.base.api.entity

import android.text.TextUtils
import com.google.gson.annotations.SerializedName
import java.io.Serializable

class DeviceMaintainList : BaseResponse() {
    var deviceList: List<Maintain>? = null
}

class Maintain : Serializable {

    @SerializedName("Id")
    var id: Long = 0

    @SerializedName("Identifier")
    var identifier: String? = null

    @SerializedName("Name")
    var name: String? = null

    @SerializedName("LastFrameTime")
    var lastFrameTime: String? = null

    @SerializedName("Height")
    var height: Float? = null

    @SerializedName("CreateOn")
    var createOn: String? = null

    @SerializedName("Model")
    var model: String? = null

    @SerializedName("Size")
    var size: String? = null

    @SerializedName("Color")
    var color: String? = null

    @SerializedName("Brand")
    var brand: String? = null

    @SerializedName("Longtitude")
    var longtitude: Double = 0.toDouble()

    @SerializedName("Latitude")
    var latitude: Double = 0.toDouble()

    @SerializedName("District")
    var district: String? = null

    @SerializedName("Order")
    var order: Int = 0

    @SerializedName("Percentage")
    var percentage: Int = 0

    @SerializedName("BinSpaceHeight")
    var binSpaceHeight: Int = 0

    @SerializedName("Status")
    var status: String? = null

    @SerializedName("Address")
    var address: String? = null

    @SerializedName("CleanStatus")
    var cleanStatus: Int = 0 // 0 还没清理  1 已经清理  2 当天需要清理但还没清理

    @SerializedName("Graffiti")
    var isGraffiti: Int = 0

    @SerializedName("Damage")
    var isDamaged: Int = 0

    @SerializedName("Burn")
    var isBurned: Int = 0

    @SerializedName("Move")
    var isMoved: Int = 0

    @SerializedName("Repair")
    var isRepairdToday: Int = 0

    @SerializedName("SensorError")
    var isSensorError: Int = 0

    @SerializedName("SensorLost")
    var isSensorLost: Int = 0


    @SerializedName("IllegalTrash")
    var isIllegalTrash: Int = 0

    @SerializedName("TrashOverflow")
    var isTrashOverflow: Int = 0

    @SerializedName("Condition")
    var condition: Float = -1f

    @SerializedName("Weight")
    var weight: Float? = null

    @SerializedName("WeightPercentage")
    var weightPercentage: Int = 0

    @SerializedName("WeightLastFrameTime")
    var weightLastFrameTime: String? = null

    @SerializedName("AshtrayFlag")
    var ashtrayFlag: Int? = null

    @SerializedName("AshtrayPerc")
    var ashtrayPercent: Int? = null


    @Transient
    var isNeedRepair: Boolean = false
        get() {
            return isBurned == 1 ||
                    isSensorLost == 1 ||
                    isSensorError == 1 ||
                    isMoved == 1 ||
                    isDamaged == 1 ||
                    isGraffiti == 1
        }

    @Transient
    var showStateView: Boolean = false

    val displayLabel: String?
        get() = if (!TextUtils.isEmpty(name)) {
            name
        } else identifier

    val displayModel: String?
        get() = if (TextUtils.isEmpty(model)) "" else model + if (TextUtils.isEmpty(size)) "" else size;


}
